Quibbox.EditMode.modules.separator = function ()
{
	function separatorDelete()
	{
		var element = $(this);
		var id = element.attr('id');
		
		Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this separator?', function (btn) {
			if (btn == "yes") {
				// Delete on server
				Quibbox.RPC.call('separator_delete', {id: id.substr(5)});
				
				// Remove from page entirely
				element.remove();
			}
		});
	};
	
	return {
		init: function(areas)
		{
			areas.find('.block.separator').dblclick(separatorDelete);
			Quibbox.EditMode.addToCatalog('other',  {
				text: 'Separator',
				module: 'separator',
				desc: 'Used to separate other types of content. The look depends on the design, but it&#39;s usually a simple horizontal bar.'
			});
		},
		
		create: function(addLink)
		{
			var areaName = addLink.parent().attr('areaName');
			
			Quibbox.RPC.call('separator_create', {area: areaName}, {success: function (data) {
				addLink.before('<div id="block'+data.id+'" class="block separator"><hr/></div>').prev()
					.dblclick(separatorDelete).show("pulsate", {times: 2}, 300);
			}});
		}
	}
}();